package com.signal;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

public class Tela3_2 extends Activity implements OnClickListener
{

	ProgressDialog pg;
	private int contador = 0;
	private int maximo = 2;
	private Handler handle = new Handler();

	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_tela4);

		Bundle t = getIntent().getExtras();
		Bitmap bm = (Bitmap) t.get("data");

		ImageView imagem = (ImageView) findViewById(R.id.ImageViewFoto);
		imagem.setImageBitmap(bm);

		findViewById(R.id.resumo_btnEnviarDados).setOnClickListener(this);
	}

	@Override
	public void onClick(View v)
	{
		pg = new ProgressDialog(this);
		pg.setTitle("Aguarde...");
		pg.setMessage("Enviando dados ao servidor...");
		pg.setIndeterminate(true);
		pg.setCancelable(true);
		pg.show();
		iniciarThread();
	}

	private void iniciarThread()
	{
		new Thread(new Runnable()
		{
			@Override
			public void run()
			{
				while (contador < maximo)
				{
					contador++;
					try
					{
						Thread.sleep(2000);
						handle.post(new Runnable()
						{
							@Override
							public void run()
							{
								System.out.println("");
							}
						});
					} catch (InterruptedException e)
					{
						e.printStackTrace();
					}
				}
				pg.dismiss();

			}
		}).start();
		Intent t = new Intent(this, Tela5.class);
		startActivity(t);
	}
}